<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>模仿接口---鸭式变型法 </title>
</head>
<body>
<script src="Interface.js"></script>
<script>
    //Interface
    var Composite=new Interface('Composite',['add','remove','getChild']);
    var FormItem=new Interface('FromItem',['save']);
    //CompositeForm class
    var CompositeForm=function (id,method,action) {
        //...
    };

    function addForm(formInstance){
        Interface.ensureImplements(formInstace,Composite,FormItem);
    }
    //Interface.ensureImplements起着严格把关的作用

</script>

</body>
</html>